#include <iostream>
#include <cstring>
using namespace std;

typedef struct{
 char data[66];
 int length;
}SqList;

int main(){
 SqList *L;
 L = new SqList;
 string str, substr;
 while(cin >> str >> substr){
  int k = 0;
  for(int i = 0; i < str.length(); i++){
   L->data[i] = str[i];
   if(str[i] > str[k])
    k = i;
  }
  L->length = str.length();
  
  for(int i = L->length+2; i > k; i--)
   L->data[i] = L->data[i-3];
  for(int i = 0; i<substr.length(); i++){
   L->data[++k] = substr[i];
  } 
  L->length += 3;
  
  for(int i = 0; i<L->length;i++)
   cout << L->data[i];
  cout << endl;
 }
}
